#pragma once
#include <websocketpp/config/asio_no_tls_client.hpp>
#include <websocketpp/client.hpp>
#include <iostream>

#include "connection_metadata.h"

//typedef websocketpp::client<websocketpp::config::asio_client> client;



class websocket_endpoint
{
public:
    websocket_endpoint();
    ~websocket_endpoint();

    int connect(std::string const& uri);
    void close(int id, websocketpp::close::status::value code, std::string reason);
    void send(int id, std::string message);

    connection_metadata::ptr get_metadata(int id) const;

private:
    typedef std::map<int, connection_metadata::ptr> con_list;

    client m_endpoint;
    websocketpp::lib::shared_ptr<websocketpp::lib::thread> m_thread;

    con_list m_connection_list;
    int m_next_id;
};

